package com.betterwood.dragon.core.config;

import cn.dev33.satoken.interceptor.SaRouteInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//@Configuration
public class MySaTokenConfig implements WebMvcConfigurer {
    // 注册sa-token的登录拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册登录拦截器，并排除登录接口地址
        registry.addInterceptor(new SaRouteInterceptor()).addPathPatterns("/**").excludePathPatterns(
                // "/user/doLogin", "/wxuser/get",
                // "/sys/user/doLogin", "/flight/list", "/user/register",
                // "/flight/info", "/flight/api", "/flight/api2", "/weather/info",
                "/wechat/msg/token", "/wxuser/insert", "/wechat/wxConfig", "/wechat/createMenu","/user/weblogin",
                "/wechat/minapp/getOpenId", "/wechat/minapp/getQr", "/wechat/minapp/getToken",
                "/wechat/minapp/getPhone", "/favicon.ico", "/doc.html", "/webjars/**", "/swagger-resources/**",
                "/v2/api-docs", "/actuator/","/flight/sendNotify", "/demo/findByManyOptionsWithPage", "/demo/create",
                "/demo/updateInlineOperation");
    }
}
